{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Single/Two-Qubit Gate\n",
    "\n",
    "*Copyright (c) 2021 Institute for Quantum Computing, Baidu Inc. All Rights Reserved.*\n",
    "\n",
    "## Outline\n",
    "\n",
    "This tutorial will demonstrate how to implement single-qubit gates and the Mølmer-Sørensen gate on the trapped ion quantum computing platform using Quanlse. The outline of this tutorial is as follows:\n",
    "\n",
    "- Introduction\n",
    "- Preparation\n",
    "- Single-qubit gate rotating around X/Y axis\n",
    "- Introduction to the Mølmer-Sørensen gate in trapped ion\n",
    "- Construct pulse sequences of the Mølmer-Sørensen gate\n",
    "- Summary\n",
    "- References"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Introduction\n",
    "\n",
    "The trapped ion is one of the first physical platforms to realize quantum computing. In recent years, significant progress had been made on the trapped ion quantum control technology. Compared to other quantum hardware platforms such as superconducting quantum computing, trapped ion has several advantages. Firstly, the qubits in trapped-ion are identical particles, which ensure the same qubit frequency. Secondly, the single/two-qubit gates have high fidelity, reaching 99.9999% and 99.9% with coherence time longer than an hour \\[1\\]. Thirdly, benefitted from the Coulomb interactions between trapped ions, qubits can achieve all-to-all connections \\[2\\].\n",
    "\n",
    "In trapped ion, a qubit is a single ion trapped by external binding potential. Individual qubit operation is implemented using additional control fields. Differing from superconducting quantum computing, which usually uses microwave and magnetic flux as the control fields, gates in trapped ion systems are usually implemented by lasers \\[3\\]. We can use a Raman processing to transform the internal state transition as shown in figure(a-b), and realize quantum operations. Users can quickly obtain the laser pulse sequences in trapped ion quantum computing using the Quanlse Trapped Ion."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Raman transition and the effective Hamiltonian**\n",
    "\n",
    "We choose the two hyperfine states of the ion to be the $|0\\rangle$ and $|1\\rangle$ state. Because of the electric dipole confinement, we need to apply a two-photons Raman transition to couple the $|0\\rangle$ and $|1\\rangle$ state, which includes a highly excited state $|e\\rangle$. As illustrated in figure(a-b), the blue laser couples $|0\\rangle$ and $|e\\rangle$ states, while the red laser couples $|e\\rangle$ and $|1\\rangle$ states.\n",
    "\n",
    "![Raman](figures/Raman-en.png)\n",
    "\n",
    "By using rotating wave approximation(RWA) and adiabatic elimination, we can derive the effective Hamiltonian of two photons Raman transition while eliminating the influence of excited state $|e\\rangle$:\n",
    "$$\n",
    "\\hat{H}_{\\rm eff}=\\frac{ \\Omega(t)}{2}\\left(\\hat{\\sigma}_{+} e^{i\\Delta\\phi}+\\hat{\\sigma}_{-} e^{-i\\Delta\\phi}\\right),\n",
    "$$\n",
    "\n",
    "where $\\hat{\\sigma}_+=(\\hat{\\sigma}_x+i\\hat{\\sigma}_y)/2, \\hat{\\sigma}_-=(\\hat{\\sigma}_x-i\\hat{\\sigma}_y)/2$, $\\hat{\\sigma}_x, \\hat{\\sigma}_y$ are Pauli matrices. $\\Delta\\phi=\\phi_1-\\phi_0$ denotes the relative phase of two laser beams implemented on the trapped ion; the Rabi frequency $\\Omega(t)$ is proportional to the product of the two laser's amplitude $\\Omega(t)\\propto E_1(t)\\cdot E_0(t)$. The Raman laser used in the laboratory usually has property $|E_1|=|E_0|$. In trapped ion quantum control, the laser's parameters can be described by $(E,\\omega,\\phi)$. Usually, restricted to the laser's construction, we fix the frequency $\\omega$ and relative phase $\\Delta\\phi$ at the initial time, and operate the qubits by adjusting the amplitude of laser. On account of the linear relation between amplitude and Rabi frequency, the quantum control parameter we refer to is the Rabi frequency $\\Omega(t)$."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Single-qubit gate in trapped ion**\n",
    "\n",
    "The matrix of the rotating gates which can be achieved directly takes form:\n",
    "\n",
    "$$\n",
    "R(\\theta,\\Delta\\phi) = \\begin{bmatrix} \n",
    "\\cos \\frac{\\theta} { 2 } & -\\mathrm{i} \\mathrm{e}^{\\mathrm{i} \\Delta\\phi} \\sin \\frac{\\theta} { 2 } \\\\\n",
    "-\\mathrm{ie}^{-\\mathrm{i} \\Delta\\phi} \\sin \\frac{\\theta} { 2 } & \\cos \\frac{\\theta} { 2 }   \n",
    "\\end{bmatrix}.\n",
    "$$\n",
    "\n",
    "When we choose the relative phase $\\Delta\\phi=0$, which corresponds to a rotating gate around the X-axis.\n",
    "\n",
    "$$\n",
    "R_x(\\theta)=\\begin{bmatrix} \n",
    "\\cos \\frac{\\theta} { 2 } &  -i \\sin \\frac{\\theta} { 2 } \\\\\n",
    "-i \\sin \\frac{\\theta} { 2 } & \\cos \\frac{\\theta} { 2 } \n",
    "\\end{bmatrix}.\n",
    "$$\n",
    "\n",
    "When we choose $\\Delta\\phi=-\\pi/2$, which corresponds to a rotating gate around the Y-axis.\n",
    "\n",
    "$$\n",
    "R_y(\\theta)=\\begin{bmatrix} \n",
    "\\cos \\frac{\\theta} { 2 } &  - \\sin \\frac{\\theta} { 2 } \\\\\n",
    " \\sin \\frac{\\theta} { 2 } & \\cos \\frac{\\theta} { 2 } \n",
    "\\end{bmatrix}.\n",
    "$$\n",
    "\n",
    "We will show how to realize single/two-qubit gates in a trapped ion system in the following sections."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Preparation\n",
    "\n",
    "After sucessfully installing Quansle, users need to import the required package:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Import math\n",
    "from math import pi\n",
    "\n",
    "# Import required packages\n",
    "from Quanlse.remoteOptimizer import remoteIonOptimize1Qubit as runIonOptimize1Qubit\n",
    "from Quanlse.Utils import Plot"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "To use Quanlse Cloud Service, the users can get a token from http://quantum-hub.baidu.com and submit the job onto Quanlse's server. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Import Define class and set the token\n",
    "# Please visit http://quantum-hub.baidu.com\n",
    "from Quanlse import Define\n",
    "Define.hubToken = \"\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Single-qubit gate rotating around X/Y axis\n",
    "\n",
    "**Rotating gate around the X-axis**\n",
    "\n",
    "First of all, we need to define the necessary parameters of a single-qubit gate in trapped ion, including the rotation `axis`, rotating angle `theta`, and gate time `tgate`:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Choose the rotating axis (ionRx/ionRy)\n",
    "axis = \"ionRx\"\n",
    "\n",
    "# The rotating angle\n",
    "theta = pi / 3\n",
    "\n",
    "# Gate duration (in microseconds)\n",
    "tgate = 2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Input the defined parameters, and use function `runIonOptimize1Qubit()`:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Run optimization\n",
    "amp, infid, uReal = runIonOptimize1Qubit(axis, theta, tgate)\n",
    "                            \n",
    "print(infid)\n",
    "print(uReal)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can obtain the pulse information required to generate a gate rotating $\\theta$ around X-axis from `ham`, gate infidelity `infid`, and the exoerimental gate unitary matrix using function `print()`. Note that the actually implemented gate differs from the target gate by a global phase $e^{i\\phi}$.\n",
    "\n",
    "We can visualize the pulse sequence using function `Plot.plotPulse()`:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "Plot.plotPulse([[tgate/2, tgate]], [[amp, amp]],\n",
    "               title=[r'Square pulse for $\\phi=0$'],\n",
    "               xLabel=r'Time ($\\mu$s)', yLabel=['Rabi frequency (a.u)'], color=['blue'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Rotating gate around Y-axis**\n",
    "\n",
    "Similarly, by setting the parameters as follows, we can obtain a rotating gate about the Y-axis:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Choose the Y-axis as the rotating axis\n",
    "axis = \"ionRy\"\n",
    "\n",
    "# The rotating angle\n",
    "theta = pi / 2\n",
    "\n",
    "# Gate duration (in microsecond)\n",
    "tgate = 2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Using the function `runIonOptimize1Qubit()`:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Run optimizer\n",
    "amp, infid, uReal = runIonOptimize1Qubit(axis, theta, tgate)\n",
    "                            \n",
    "print(infid)\n",
    "print(amp)\n",
    "print(uReal)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can also obtain the pulse information required to generate a gate rotating $\\theta$ around Y-axis from `ham`. Via the `Plot.plotPulse()` function, we can visualize the generated laser pulse sequences."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "Plot.plotPulse([[tgate / 2, tgate]], [[amp, amp]],\n",
    "               title=[r'Square pulse for $\\phi=-\\pi/2$'],\n",
    "               xLabel=r'Time ($\\mu$s)', yLabel=['Rabi frequency (a.u)'], color=['blue'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The channels of laser changes when we choose different rotating axis. If we select the $X$ axis, the laser couples to the system through $\\hat\\sigma_x$; select $Y$ axis, the laser couples to the system through $\\hat\\sigma_y$."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Introduction to the Mølmer-Sørensen gate in trapped ion\n",
    "\n",
    "To realize universal quantum computing, in addition to the single-qubit rotating gate, it is also necessary to achieve entangling two-qubit gate. We introduce the native two-qubit gate in trapped ion quantum computing - the Mølmer-Sørensen gate. We will then illustrate the physics behind the Mølmer-Sørensen gate and how to generate corresponding pulses using Quanlse \\[4\\].\n",
    "\n",
    "**Principle of the Mølmer-Sørensen gate**\n",
    "\n",
    "![Raman](figures/MSgate-en.png)\n",
    "\n",
    "In trapped ion quantum computing, two qubits transmit information through the collective vibrational phonon mode of the ion chain. Under the action of four laser beams, the effective Hamiltonian of the system can be written as:\n",
    "\n",
    "$$\n",
    "\\hat{H}_{\\rm M S}= \\hbar \\sum_{j=\\{m,n\\}} \\Omega_{j}(t) \\hat{{\\sigma}}_{x}^{j}\\sum_{k=1}^{N}\\eta_{j,k}e^{i\\mu t}\\left(\\hat{a}_k e^{-i \\omega_{k} t}+\\hat{a}_k^{\\dagger} e^{i \\omega_{k} t}\\right) + {\\rm H.c.},\n",
    "$$\n",
    "\n",
    "where $j,k$ denote the ion and phonon indices. $\\{m,n\\}$ is the ion position implemented by the laser. $N$ denotes the total ion number, which also represents the phonon number in the ion chain. $\\mu$ denotes the laser detuning, which is related to the gate duration by $\\mu=2\\pi/t_g$. $\\hat{\\sigma}_x^j$ is the $j$th ion's Pauli matrix, $\\hat a_k^\\dagger,\\ \\hat a_k$ denote the $k$th phonon creation and annihilation operation. $\\Omega_j$ are the pulse sequences that need to be optimized. Usually we have $\\Omega_m(t)=\\Omega_n(t)$. $\\eta_{j,k}$ is the Lamb-Dicke parameters of the phonon mode, $\\omega_k$ represents the vibration frequency of phonons. For convenience, we set $\\hbar=1$ in the following sections."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**From the Hamiltonian $\\hat{H}_{\\rm MS}$ to unitary operation $U$**\n",
    "\n",
    "The parameters $\\{\\eta_{j,k},\\omega_k\\}$ in the effective Hamiltonian are related to the trapped potential $V(x,y,z)=\\frac{1}{2}\\omega_z^2 z^2-\\frac{1}{2}\\omega_{xy}^2(x^2+y^2)$ and total ion number $N$ in the chain. In the one-dimensional ion chain, we need to make sure that $\\omega_z \\ll \\omega_{xy}$ and the Lamb-Dicke parameter $\\eta_{j,k}\\ll 1$, so that the time-dependent evolution of the effective Hamiltonian can be expanded to the 2nd order of the Magnus formula：\n",
    "\n",
    "$$\n",
    "U(t_g)=\\exp \\left[-i\\sum_{j=\\{m,n\\}}\\hat{\\sigma}_{x}^{j}\\sum_{k=1}^{N}\\left(\\alpha_{j, k}(t_g) \\hat{a}_{k}^{\\dagger}-\\alpha_{j, k}^{*}(t_g) \\hat{a}_{k}\\right) +i\\chi_{m,n}(t_g)\\hat{\\sigma}_{x}^{m}\\hat{\\sigma}_{x}^{n}+O(\\eta^3)\\right],\n",
    "$$\n",
    "\n",
    "Here, \n",
    "$$\n",
    "\\alpha_{j, k}(t_g)=\\int_0^{t_g} dt f(\\eta_{k,j},\\Omega_j(t),\\omega_k),\n",
    "$$\n",
    "\n",
    "$$\n",
    "\\chi_{m,n}(t_g)=\\sum_k\\int_0^{t_g} dt\\int_0^{t} dt_1 g(\\eta_{k,m},\\eta_{k,n},\\Omega_m(t), \\Omega_n(t_1), \\omega_k).\n",
    "$$\n",
    "\n",
    "The integral functions $\\{f,g\\}$ are related to laser pulse. We can set the pulse $\\Omega_j(t)$ to be a square pulse sequence $[A_1,A_2,\\cdots,A_{n_{2N+1}}]$ ($A_n$ is the $n$th sequence amplitude）or Fourier-sine basis $\\Omega_j(t)=\\sum_{n=1}^{2N+1}A_n \\sin(2\\pi n t/t_g)$. By adjusting the agrument $A_n$ in pulse $\\Omega_j(t)$, we can obtain the pulse sequence $\\Omega_j(t)$, which gives $\\alpha_{j, k}(t_g)=0,\\chi_{m,n}(t_g)=\\frac{\\pi}{4}$, and finally construct the Mølmer-Sørensen gate:\n",
    "\n",
    "$$\n",
    "{\\rm MS}=U(t_g)=e^{i\\frac{\\pi}{4}\\hat{\\sigma}_x^m\\otimes\\hat{\\sigma}_x^n}=\\frac{1}{\\sqrt{2}}\\left(\\begin{array}{cccc}\n",
    "1 & 0 & 0 & i \\\\\n",
    "0 & 1 & i & 0 \\\\\n",
    "0 & i & 1 & 0 \\\\\n",
    "i & 0 & 0 & 1\n",
    "\\end{array}\\right).\n",
    "$$\n",
    "\n",
    "Mølmer-Sørensen gate can be constructed by local unitary gates and the CNOT gate in quantum computing, the effective quantum circuits are as follow:\n",
    "\n",
    "![MSgate](figures/MS-CNOT.PNG)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Construct pulse sequences of the Mølmer-Sørensen gate\n",
    "\n",
    "To construct the pulse sequences of the Mølmer-Sørensen gate in the trapped ion quantum computing platform, we need to import the related package from Quanlse:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Import Molmer-Sorensen gate optimizer module\n",
    "from Quanlse.remoteOptimizer import remoteIonMS as runIonMS\n",
    "\n",
    "# Import plot funciton from Quanlse\n",
    "from Quanlse.Utils import Plot"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Firstly, we need to define the general information of the qubits in the ion trap, including the number of ion in the chain which is usually less than 30, the type (mass) of the ion, the horizontal and vertical binding potential of the trapped potential, and the vibration phonon mode that users choose to transmit quantum information:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Set the ion number in the trapped potential which is usually less than 30\n",
    "ionNumber = 6\n",
    "\n",
    "# Set atom mass/type in the trapped potential\n",
    "atomMass = 171\n",
    "\n",
    "# Set trapped potential parameter\n",
    "omegaZ = 2 * pi * 0.2e6\n",
    "omegaXY = 2 * pi * 2e6\n",
    "\n",
    "# Choose transverse or axial phonon mode\n",
    "phononMode = \"transverse\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Secondly, to perform the Mølmer-Sørensen gate on two ions, we specify the ions' index, the gate duration time `tgate`, as well as the user-defined laser's waveform (we support square wave `squareWave` and Fourier-sine basis `sinWave`):"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Set operating ion index\n",
    "ionM = 0\n",
    "ionN = 2\n",
    "\n",
    "# Set the gate time\n",
    "tgate = 200\n",
    "\n",
    "# Choose the pulse waveform, where we support squareWave and sinWave\n",
    "pulseWave = \"squareWave\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We use the `runIonMS()` function, and pass in the trapped ion configuration above as arguments:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "res, unitary = runIonMS(ionNumber=ionNumber, atomMass=atomMass, tg=tgate, omega=(omegaXY, omegaZ),\n",
    "                        ionIndex=(ionM, ionN), pulseWave=pulseWave, phononMode=phononMode)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We obtained the calculated results, where the `res` contains the position of the qubit in the trapped ion quantum system, collective vibration phonon mode frequency, system Lamb-Dicke coefficient matrix, formation of the Mølmer-Sørensen gate pulse sequence, and the gate infidelity. `unitary` represents the real gate corresponding to the pulse. Users can easily print out these results using the following commands:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "print(f\"The trapped ion axial phonon mode frequencies are:\\n {res['phonon_freq']}\\n\")\n",
    "print(f\"The trapped ion axial Lamb-Dicke parameters are:\\n {res['lamb_dicke']}\\n\")\n",
    "print(f\"Infidelity is: {res['infidelity']}\\n\")\n",
    "print(unitary)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "At the same time, the position of the qubit can be visualized by calling the function `Plot.plotIonPosition()`:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "Plot.plotIonPosition(res['ion_pos'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "And we can plot the pulse sequences which form the Mølmer-Sørensen gate by using `Plot.plotPulse()`:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "Plot.plotPulse([res['time']], [res['omega']],\n",
    "                title=['Square pulse for Mølmer-Sørensen gate in trapped ion'],\n",
    "                xLabel=r'Time ($\\mu$s)', yLabel=['Rabi frequency (a.u)'], color=['blue'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "In addition to the square waveform commonly used in experiments, Quanlse also supports the Fourier-sine wave pulse. Similarly, we can obtain the pulse information regarding the Mølmer-Sørensen gate formed by the Fourier-sine waves:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Choose the pulse waveform (squareWave/sinWave)\n",
    "pulseWave = \"sinWave\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "res, unitary = runIonMS(ionNumber=ionNumber, atomMass=atomMass, tg=tgate, omega=(omegaXY, omegaZ),\n",
    "                        ionIndex=(ionM, ionN), pulseWave=pulseWave, phononMode=phononMode)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Users can easily print information such as the gate infidelity and the parameters of the system Hamiltonian through the following commands:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "print(f\"The trapped ion axial phonon mode frequencies are:\\n {res['phonon_freq']}\\n\")\n",
    "print(f\"The trapped ion axial Lamb-Dicke parameters are:\\n {res['lamb_dicke']}\\n\")\n",
    "print(f\"Infidelity is: {res['infidelity']}\\n\")\n",
    "print(unitary)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "At the same time, the qubits' position can be visualized by calling the `Plot.plotIonPosition()`:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "Plot.plotIonPosition(res['ion_pos'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Plot the Fourier-sine pulse sequences of the Mølmer-Sørensen gate using `Plot.plotPulse()`:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "Plot.plotPulse([res['time']], [res['omega']],\n",
    "                title=['Sin pulse for Mølmer-Sørensen gate in trapped ion'],\n",
    "                xLabel=r'Time ($\\mu$s)', yLabel=['Rabi frequency (a.u)'], color=['blue'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "In conclusion, through Quanlse's `runIonMS()` module, we obtain the corresponding phonon vibration frequency in one-dimensional trapped ion, the Lamb-Dicke coefficient in the ion chain, the gate infidelity and the actual evolution. Simultaneously, the Quanlse module has a built-in plotting module, which allows users to visualize the corresponding position of each qubit and pulse sequences of the Mølmer-Sørensen gate easily."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Summary\n",
    "\n",
    "Using Quanlse, we can quickly extract the Hamiltonian information of the one-dimensional ion chain, including the ion position, calibration information, the phonon vibration mode, the Lamb-Dicke parameters, and the pulse waveform of the single-qubit gates or the Mølmer-Sørensen gate. Users can follow this link [tutorial-iontrap.ipynb](https://github.com/baidu/Quanlse/blob/main/Tutorial/EN/tutorial-ion-trap-single-and-two-qubit-gate.ipynb) to the corresponding GitHub page of this Jupyter Notebook to download the code above.\n",
    "\n",
    "We encourage users to try different parameters, and explore the further functionalities of the Quanlse Trapped Ion module."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## References\n",
    "\\[1\\] [Wright, K., et al. \"Benchmarking an 11-qubit quantum computer.\" *Nature communications* 10.1 (2019): 1-6.](https://www.nature.com/articles/s41467-019-13534-2)\n",
    "\n",
    "\\[2\\] [Bruzewicz, Colin D., et al. \"Trapped-ion quantum computing: Progress and challenges.\" *Applied Physics Reviews* 6.2 (2019): 021314.](https://aip.scitation.org/doi/abs/10.1063/1.5088164)\n",
    "\n",
    "\\[3\\] [Häffner, Hartmut, Christian F. Roos, and Rainer Blatt. \"Quantum computing with trapped ions.\" *Physics reports* 469.4 (2008): 155-203.](https://www.sciencedirect.com/science/article/abs/pii/S0370157308003463)\n",
    "\n",
    "\\[4\\] [Sørensen, Anders, and Klaus Mølmer. \"Quantum computation with ions in thermal motion.\" *Physical review letters* 82.9 (1999): 1971.](https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.82.1971)"
   ]
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "6b492610b12c5527f6547446ce2a29ad5c1ce3bfe5e6c0e554dc04678ce49b99"
  },
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
